package com.ruoyi.basedata.controller;

import com.ruoyi.basedata.domain.WfzGybaseunit;
import com.ruoyi.basedata.service.IWfzGybaseunitService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Api("基础资料接口")
@Validated
@RestController
@RequestMapping("/api/basedata")
public class BaseDataApiController {

    @Autowired
    private IWfzGybaseunitService gybaseunitService;

    @ApiOperation("盖亚组织接口")
    @Log(title = "盖亚组织接口",businessType = BusinessType.BASEDATA_API)
    @PostMapping("/gybaseunit")
    public AjaxResult importGybaseunit(@RequestBody @Valid WfzGybaseunit gybaseunit){
        AjaxResult ajax = AjaxResult.success();
        int i = gybaseunitService.insertWfzGybaseunit(gybaseunit);
        if (i == 1){
            ajax.put("msg","保存成功");
            ajax.put("state","1");
        }else {
            ajax.put("msg","保存失败");
            ajax.put("state","0");
        }
        return ajax;
    }

}
